﻿
Partial Class HelloWorld
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim cn As System.Data.OleDb.OleDbConnection
        Dim cmd As System.Data.OleDb.OleDbCommand
        Dim dr As System.Data.OleDb.OleDbDataReader

        'Provider=vfpoledb;Data Source=C:\MyDbFolder\MyDbContainer.dbc;Collating Sequence=machine;
        'D:\wwwroot\laiyifan\wwwroot 
        'Provider=vfpoledb;Data Source=C:\MyDataDirectory\;Collating Sequence=general;

        Dim connectionString, sql As String
        'connectionString = "Provider=vfpoledb;Data Source={0}\Data\car.dbc;Collating Sequence=machine"
        connectionString = "Provider=vfpoledb;Data Source={0}\Data\;"
        sql = "SELECT COUNT(*) AS CNT FROM fd"
        Dim dt As New System.Data.DataTable()
        Try
            cn = New System.Data.OleDb.OleDbConnection
            cn.ConnectionString = String.Format(connectionString, Server.MapPath("."))
            cn.Open()

            cmd = cn.CreateCommand()
            cmd.CommandText = sql
            dr = cmd.ExecuteReader(Data.CommandBehavior.CloseConnection)
            dt.Load(dr)
        Catch ex As Exception
            Response.Write(ex.Message)
        Finally
            cn.Close()
        End Try










        Response.Write(cn.ConnectionString + "<br>")
        Response.Write(dt.Rows(0)("CNT").ToString())

    End Sub
End Class
